@ECHO OFF
cd %~ps0
for %%X in (java.exe) do (set JAVAFOUND=%%~$PATH:X)
for %%X in (python.exe) do (set PYTHONFOUND=%%~$PATH:X)
net stop pytivo
if defined PYTHONFOUND (
  echo Python was found
  goto runpython
)

if defined JAVAFOUND (
  echo JAVA was found
  goto runjython
)

echo Neither java or python was found.  Please install one
pause
goto end

:runjython
java -jar pytivo.jar pytivo.py -c pytivo.conf
goto end

:runpython
python.exe pytivo.py -c pytivo.conf
goto end

:end
pause